// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_fk;

import android.content.Context;
import android.content.pm.*;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.*;
import com.nnee.p_pr.p_app.cls_PrisApp;
import java.util.*;

// Referenced classes of package com.nnee.p_fk:
//            b, h, l

public class cls_k
{

    private cls_k(Context context)
    {
        k = null;
        o = new WeakHashMap();
        k = context;
        m = k.getResources();
        p = k.getPackageName();
        q = k.getPackageManager();
        a();
    }

    public static cls_k a(Context context)
    {
        cls_k k1;
        if(e != null)
        {
            k1 = e;
        } else
        {
            b(context);
            k1 = e;
        }
        return k1;
    }

    public static void a(View view, Drawable drawable)
    {
        if(view != null && drawable != null)
        {
            int i1 = view.getPaddingLeft();
            int j1 = view.getPaddingTop();
            int k1 = view.getPaddingRight();
            int l1 = view.getPaddingBottom();
            view.setBackgroundDrawable(drawable);
            view.setPadding(i1, j1, k1, l1);
        }
    }

    private void a(View view, cls_b b1)
    {
        if(view != null && b1 != null) {
        	int j1;
            int k1;
            int l1;
            boolean flag;
            Drawable drawable;
        	int i1 = b1.a();
            if(i1 > 0)
            {
                
                if(view.findViewById(0x7f0d0017) != null || view.getId() == 0x7f0d0017)
                    flag = true;
                else
                    flag = false;
                drawable = b(i1);
                if(flag)
                    if(drawable == null);
                a(view, drawable);
            }
            j1 = b1.b();
            if(j1 > 0 && (view instanceof TextView))
                ((TextView)view).setTextColor(c(j1));
            k1 = b1.c();
            if(k1 > 0 && (view instanceof ListView))
                ((ListView)view).setDivider(b(k1));
            l1 = b1.d();
            if(l1 > 0 && (view instanceof ImageView))
                ((ImageView)view).setImageDrawable(b(l1));
            
        }
    }

    private static void b(Context context)
    {
        e = null;
        if(context != null)
            e = new cls_k(context.getApplicationContext());
    }

    public int a(int i1)
    {
        if(l != null) {
        	int j1 = l.c(i1);
            if(j1 > 0)
                i1 = j1;
        }
        return i1;

    }

    public cls_l a(String s)
    {
    	cls_l l1 = null;
        if(!TextUtils.isEmpty(s)) {
        	PackageInfo packageinfo=null;
			try {
				packageinfo = q.getPackageInfo(s, 1);
			} catch (NameNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            Object obj = packageinfo;
            l1 = a(s, q, ((PackageInfo) (obj)), true);
        }

        return l1;

    }

    public cls_l a(String s, PackageManager packagemanager, PackageInfo packageinfo, boolean flag)
    {
    	 cls_l l1;
        if(packagemanager == null || packageinfo == null)
        {
            l1 = null;
        } else
        {
            l1 = new cls_l();
            l1.a(s);
            ApplicationInfo applicationinfo = packageinfo.applicationInfo;
            String s1 = applicationinfo.packageName;
            l1.b(s1);
            if(p.equals(s1))
            {
                l1.c(null);
                l1.a(k.getResources().getDrawable(0x7f02005e));
            } else
            {
                l1.c(packagemanager.getApplicationLabel(applicationinfo).toString());
                l1.a(packagemanager.getApplicationIcon(applicationinfo));
            }
            l1.d(packageinfo.versionName);
            l1.a(flag);
            l1.b(s1.equals(cls_PrisApp.a().A()));
        }
        return l1;
    }

    public void a()
    {
        String s = cls_PrisApp.a().A();
        if(TextUtils.isEmpty(s) || p.equals(s))
            n = f();
        else
        if(s.equals("internal.skin.black"))
        {
            n = cls_PrisApp.a().B();
        } else
        {
            cls_l l1 = a(s);
            if(l1 == null)
                l1 = f();
            n = l1;
        }
    }

    public void a(View view, AttributeSet attributeset)
    {
        if(view != null && attributeset != null) {
        	cls_b b1 = new cls_b(this, null);
            TypedArray typedarray = view.getContext().obtainStyledAttributes(attributeset, f);
            TypedValue typedvalue = typedarray.peekValue(0);
            if(typedvalue != null && typedvalue.resourceId != 0)
                b1.a(typedvalue.resourceId);
            typedarray.recycle();
            TypedArray typedarray1 = view.getContext().obtainStyledAttributes(attributeset, g);
            TypedValue typedvalue1 = typedarray1.peekValue(0);
            if(typedvalue1 != null && typedvalue1.resourceId != 0)
                b1.b(typedvalue1.resourceId);
            typedarray1.recycle();
            TypedArray typedarray2 = view.getContext().obtainStyledAttributes(attributeset, h);
            TypedValue typedvalue2 = typedarray2.peekValue(0);
            if(typedvalue2 != null && typedvalue2.resourceId != 0)
                b1.c(typedvalue2.resourceId);
            typedarray2.recycle();
            TypedArray typedarray3 = view.getContext().obtainStyledAttributes(attributeset, i);
            TypedValue typedvalue3 = typedarray3.peekValue(0);
            if(typedvalue3 != null && typedvalue3.resourceId != 0)
                b1.d(typedvalue3.resourceId);
            typedarray3.recycle();
            synchronized(o)
            {
                o.put(view, b1);
            }
            if(!c())
                a(view, b1);
        }

    }

    public void a(cls_h h1)
    {
        l = h1;
        if(l == null)
            n = f();
    }

    public void a(cls_l l1)
    {
        if(l1 == null)
            l1 = f();
        n = l1;
    }

    public Drawable b(int i1)
    {
    	Drawable drawable = m.getDrawable(i1);
        if(l != null){
        	Drawable drawable1 = l.a(i1);
            drawable = drawable1;
            if(drawable != null){}
            else
            {
            if(drawable == null)
                drawable = m.getDrawable(i1);
            }
        }
 
        return drawable;

    }

    public cls_l b()
    {
        if(n == null)
            n = f();
        return n;
    }

    public int c(int i1)
    {
    	 int j1 = m.getColor(i1);
    	 
        if(l != null) {
        	int k1 = l.b(i1);
            j1 = k1;
         
        }

       
        return j1;

    }

    public boolean c()
    {
        boolean flag;
        if(n == null)
        {
            n = f();
            flag = true;
        } else
        {
            flag = p.equals(n.b());
        }
        return flag;
    }

    public cls_h d()
    {
        return l;
    }

    public void e()
    {
        WeakHashMap weakhashmap = o;
        
        o.size();
        Iterator iterator = o.entrySet().iterator();
        do
        {
            if(!iterator.hasNext())
                break;
            java.util.Map.Entry entry = (java.util.Map.Entry)iterator.next();
            View view = (View)entry.getKey();
            cls_b b1 = (cls_b)entry.getValue();
            if(b1 != null)
                a(view, b1);
        } while(true);
        
    }

    public cls_l f()
    {
        PackageInfo packageinfo1=null;
		try {
			packageinfo1 = q.getPackageInfo(k.getPackageName(), 0);
		} catch (NameNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        PackageInfo packageinfo = packageinfo1;

        return a(null, q, packageinfo, true);

    }

    public static final String a = "pris\\.skin\\..*";
    public static final String b = "internal\\.skin\\..*";
    public static final String c = "internal.skin.black";
    private static final String d = "SkinManager";
    private static cls_k e = null;
    private static int f[];
    private static int g[];
    private static int h[];
    private static int i[];
    private static int j[];
    private Context k;
    private cls_h l;
    private Resources m;
    private cls_l n;
    private WeakHashMap o;
    private String p;
    private PackageManager q;

    static 
    {
        int ai[] = new int[1];
        ai[0] = 0x10100d4;
        f = ai;
        int ai1[] = new int[1];
        ai1[0] = 0x1010098;
        g = ai1;
        int ai2[] = new int[1];
        ai2[0] = 0x1010129;
        h = ai2;
        int ai3[] = new int[1];
        ai3[0] = 0x1010119;
        i = ai3;
        int ai4[] = new int[1];
        ai4[0] = 0x1010034;
        j = ai4;
    }
}
